package iotwisp.school.device.entity;

import iotwisp.base.orm.StringIdBaseEntity;
import iotwisp.school.area.entity.Scene;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * 一个场景中的一个设备场景状态
 */
@SuppressWarnings("serial")
@Data
@EqualsAndHashCode(callSuper = false)
@DynamicUpdate
@DynamicInsert
@Entity
@Table(name = M.TABLE_PREFIX + "scene_item")
@Inheritance(strategy = InheritanceType.JOINED)
public class SceneItem extends StringIdBaseEntity {

    /**
     * 所属场景
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "scene_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private Scene scene;
}
